/**
 * Created by EZ on 2017/5/25.
 */
$(document).ready(function(){

    $("#btn").click(function(k) {
        //...
        var j = $("form").serializeArray();//序列化name/value
        $.ajax({
            type: 'GET',  //这里用GET
            url: 'ajax.php',
            dataType: 'jsonp',  //类型
            data: j,
            jsonp: 'callback', //jsonp回调参数，必需
            async: false,
            success: function(result) {//返回的json数据
                alert(result.message); //回调输出

                result = result || {};
                if (result.msg=='err'){
                    alert(result.info);
                }else if (result.msg=="ok"){
                    alert('提交成功');
                }else{
                    alert('提交失败');
                }

            },
            timeout: 3000
        })
        //...
    });

});